home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / PSP.C < prev    next >
C/C++ Source or Header  |  1993-05-27  |  4KB  |  98 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 05-25-93 (16:18)             Number: 109
  4. From: PAT DONOVAN                  Refer#: 164
  5.   To: DONG NGUYEN                   Recvd: NO  
  6. Subj: PSP                            Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. #include <stdio.h> /* fprintf  NULL*/
  9. #include <dos.h> /* _psp+ MK_FP */
  10.  
  11. #ifndef __LARGE__
  12. error : BORLAND PRODUCT. try LARGE model
  13. #endif
  14.  
  15. typedef struct{
  16. unsigned  bit_0 :   1;   /* written by + donated to public domain */
  17. unsigned  bit_1 :   1;   /* by pat donovan sept/92 */
  18. unsigned  bit_2 :   1;
  19. unsigned  bit_3 :   1;   /* nb: I want my mommy! */
  20. unsigned  bit_4 :   1;              /* pat */
  21. unsigned  bit_5 :   1;
  22. unsigned  bit_6 :   1;
  23. unsigned  bit_7 :   1;
  24. unsigned  bit_8 :   1;
  25. }BYTELOOK;
  26. int offset[] ={0,0x0,0x2,0x4,           0x5,0x6,0x8,
  27.            0xa,0xe,0x12,                0x16,0x18,0x2c,
  28.            0x2e,0x32,0x34,              0x38,0x3c,0x40,
  29.            0x42,0x48,0x49,              0x50,0x53,0x5c,
  30.            0x6c,0x7c,0x0};
  31. int size[]={0,2,2,1,1,2,        2,4,4,4,2,
  32.             20,2,4,2,4,         4,4,2,6,1,
  33.             7,3,9,16,16,        4,0};
  34. char *msg[] = {
  35.        " ",
  36.        "_psp:00h int20      2 bytes",       "_psp:02h lastbyte      word",
  37.        "_psp:04h blank1        byte",       "_psp:05h serreg        byte",
  38.        "_psp:06h first_com_seg word",       "_psp:08h remd       2 bytes",
  39.        "_psp:0ah term_addr    dword",       "_psp:oeh ctrlbrk_add  dword",
  40.        "_psp:12h int24        dword",       "_psp:16h psp_addr      word",
  41.        "_psp:18h JFT       20 bytes",       "_psp:2ch envr          word",
  42.        "_psp:2eh SS/SP        dword",       "_psp:32h size_of_JFT   word",
  43.        "_psp:34h JFT ADDR_2   dword",       "_psp:38h prv_psp_addr dword",
  44.        "_psp:3ch blank2     4 bytes",       "_psp:40h int21_ret  2 bytes",
  45.        "_psp:42h blank3     6 bytes",       "_psp:48h non_win_3  1 bytes",
  46.        "_psp:49h blank4     7 bytes",       "_psp:50h bserv_reg  3 bytes",
  47.        "_psp:53h blank5     9 bytes",       "_psp:5ch FCB1      16 bytes",
  48.        "_psp:6ch FCB2      16 bytes",       "_psp:7ch blank6     4 bytes",
  49. };
  50.  
  51. void printbytes(long HEXADDRESS,unsigned count,unsigned line,
  52.                  char *label, FILE *f1)
  53. { unsigned num;
  54.   static char buff[128];
  55.         fprintf( f1," ADDRESS   bytes  %s  _psp = %4X  \n",label, _psp);
  56.         for(num=0;num<count;num++,HEXADDRESS++){
  57.                 BYTELOOK one = *(BYTELOOK *)HEXADDRESS;
  58.                 long c = HEXADDRESS;
  59.                 fprintf( f1," %Fp %d %d %d %d %d %d %d %d ",HEXADDRESS,
  60.                             one.bit_1,one.bit_2,one.bit_3,one.bit_4,
  61.                             one.bit_5,one.bit_6,one.bit_7,one.bit_8);
  62.                 fprintf( f1,"asccii. %c HEX. %2X  byte %3d \n",
  63.                             (*((char *) c)),(*((char *) c)), num );
  64.                 buff[num-1] = *(char *)c;
  65.      }
  66.      fprintf( f1,"%c %2d:%Fp %s %s \n\n",
  67.             219,line,HEXADDRESS-count,(char *)msg[line],(char *)buff);
  68. }
  69.  
  70. int main(int argc, char *argv[]){
  71.  char index=0;
  72.  
  73.  
  74.   FILE *f1= fopen(argv[1], "w");
  75.   if( !argc || f1 == NULL) f1= stdout;
  76.  
  77.     system("COMMAND");
  78.  
  79.   puts("this will create a file with <progname> output.nam ");
  80.   puts("  or just dump 11K to the screen one line at a time.");
  81.  
  82.  for(index=1;index<27;index++)
  83.     printbytes((long)MK_FP(_psp,offset[index]),
  84.                 size[index],index,msg[index],f1);
  85.  
  86.    fclose(f1);
  87.  
  88.     return(1);
  89. }
  90. /* i havo *no * idea why I shelled in this. Prob'ly to look at a memmap. pat */
  91.  
  92.  
  93. --- Maximus 2.01wb
  94.  * Origin: Ned's Opus * Northern FDN Connection * (1:243/14)
  95. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  96. SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 261/1023
  97. SEEN-BY: 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  98.